<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org" >
<head>
    <meta charset="UTF-8">
    <title>用户登录</title>
</head>
<body>
<h1>欢迎<span th:if="${session.user!=null}" th:text="${session.user.username}"></span>
</h1>
<h3>文件列表</h3>
<table border="1px">
    <tr>
        <th>ID</th>
        <th>文件原始名称</th>
        <th>文件的新名称</th>
        <th>文件后缀</th>
        <th>存储路径</th>
        <th>文件大小</th>
        <th>类型</th>
        <th>是否是图片</th>
        <th>下载次数</th>
        <th>上传时间</th>
        <th>操作</th>
    </tr>
        <tr th:each="file,fileStat:${files}">
            <td><span th:text="${file.id}"></span></td>
            <td><span th:text="${file.oldFileName}"></span></td>
            <td><span th:text="${file.newFileName}"></span></td>
            <td><span th:text="${file.ext}"></span></td>
            <td><span th:text="${file.path}"></span></td>
            <td><span th:text="${file.size}"></span></td>file
            <td><span th:text="${file.type}"></span></td>
            <td><img th:if="${file.isImg}=='是'" style="width: 100px;height: 40px;" th:src="${#servletContext.contextPath}+${file.path}+'/'+${file.newFileName}" alt="">
                    <span th:if="${file.isImg}!='是'" th:text="${file.isImg}"/>
            </td>
            <td><span th:text="${file.downcounts}"></span></td>
            <td><span th:text="${file.uploadTime}"></span></td>
            <td>
                <a th:href="@{/file/download(id=${file.id})}">下载</a>
                <a th:href="@{/file/download(id=${file.id},openStyle='inline')}">在线打开</a>
                <a th:href="@{/file/delete(id=${file.id})}">删除</a>
            </td>
        </tr>
</table>
<hr>
<h3>上传文件</h3>
<form th:action="@{/file/upload}"  method="post" enctype="multipart/form-data">
    <input type="file" name="aaa"><input type="submit" value="上传文件">
</form>
</body>
</html>